import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:netease_music/player/controller/audio_player_controller.dart';

class BottomPlayerBox extends StatelessWidget {
  final Widget child;
  const BottomPlayerBox({
    super.key,
    required this.child,
  });

  @override
  Widget build(BuildContext context) {
    // 需要动态显示隐藏底部播放栏的页面使用
    return Stack(
      children: [
        GetBuilder<AudioPlayerController>(
          builder: (controller) {
            if (controller.currentSong.isEmpty) {
              Positioned(
                top: 0,
                bottom: 0,
                left: 0,
                right: 0,
                child: child,
              );
            }
            return Positioned(
              top: 0,
              bottom: 50,
              left: 0,
              right: 0,
              child: child,
            );
          },
        )
      ],
    );
  }
}
